/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/08/22
*/
#ifndef __EDUI_PARSER_H__
#define __EDUI_PARSER_H__

#include "../defines.h"

EDUI_NAMESPACE_BEGIN

class EDUI_API Parser
{
public:
    Parser(const char* text);
    ~Parser();

    class EDUI_API Attribute
    {
        friend class Parser;
    public:
        const char* Name();
        const char* Value();
    protected:
        Attribute();
        void Reset(const char* name, const char* value);
        void Reset(const char* name, size_t namelen, const char* value, size_t valuelen);

        char* m_name;
        char* m_value;
    };

    class EDUI_API Value
    {
    public:
        Value(const char* text);
        ~Value();
        const char* First();
        const char* Next();
    private:
        char* m_text;
        const char* m_pos;
        char* m_value;
        bool m_bend;
    };

    Attribute* First();
    Attribute* Next();
private:
    char* m_text;
    const char* m_pos;
    Attribute m_attr;
};

EDUI_NAMESPACE_END

#endif